package com.esthome.T;

import com.esthome.utils.RedisConnectionPool;
import org.junit.Test;
import redis.clients.jedis.Jedis;

public class TestJavaRedis {


    @Test
    public void m(){
        //1 设置ip地址和端口
        Jedis jedis =new Jedis("192.168.111.128",6379);
        //2 设置数据
        jedis.set("name", "ss");
        //3 获得数据
        String name = jedis.get("name");
        System.out.println(name);
        //4 释放资源
        jedis.close();
    }
    @Test
    public void m2(){
        Jedis jedis = RedisConnectionPool.getJedis();
        jedis.set("abc", "连接池");
        //3 获得数据
        String name = jedis.get("abc");
        System.out.println(name);
        //4 释放资源
        jedis.close();
    }

}
